home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / SuperLaserB.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  3.0 KB  |  121 lines

  1. class classes.bro.SuperLaserB
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var pos;
  8.    var clip;
  9.    var axis;
  10.    var w;
  11.    var h;
  12.    var power;
  13.    var exploX;
  14.    var exploY;
  15.    var xMov = 0;
  16.    var yMov = 0;
  17.    function SuperLaserB(px, py, pDir, ppos, pid)
  18.    {
  19.       this.x = px;
  20.       this.y = py;
  21.       this.id = pid;
  22.       this.dir = pDir;
  23.       this.pos = ppos;
  24.       _root.d = _root.d + 1;
  25.       this.clip = _root.attachMovie("superLaserB","superLaserB" + this.id + "Clip",_root.d + 5000);
  26.       this.clip._x = this.x;
  27.       this.clip._y = this.y;
  28.       this.clip.id = this.id;
  29.       if(this.pos == "top")
  30.       {
  31.          if(this.dir == "U")
  32.          {
  33.             this.axis = "y";
  34.             this.yMov = -25;
  35.             this.xMov = _root.randRange2(-8,-4);
  36.             this.y += 25;
  37.          }
  38.          else if(this.dir == "D")
  39.          {
  40.             this.axis = "y";
  41.             this.yMov = 25;
  42.             this.xMov = _root.randRange2(4,8);
  43.             this.y -= 25;
  44.          }
  45.          else if(this.dir == "R")
  46.          {
  47.             this.axis = "x";
  48.             this.yMov = _root.randRange2(-8,-4);
  49.             this.xMov = 25;
  50.             this.x -= 25;
  51.          }
  52.          else
  53.          {
  54.             this.axis = "x";
  55.             this.yMov = _root.randRange2(-8,-4);
  56.             this.xMov = -25;
  57.             this.x += 25;
  58.          }
  59.       }
  60.       else if(this.dir == "U")
  61.       {
  62.          this.axis = "y";
  63.          this.yMov = -25;
  64.          this.xMov = _root.randRange2(4,8);
  65.          this.y += 25;
  66.       }
  67.       else if(this.dir == "D")
  68.       {
  69.          this.axis = "y";
  70.          this.yMov = 25;
  71.          this.xMov = _root.randRange2(-8,-4);
  72.          this.y -= 25;
  73.       }
  74.       else if(this.dir == "R")
  75.       {
  76.          this.axis = "x";
  77.          this.yMov = _root.randRange2(4,8);
  78.          this.xMov = 25;
  79.          this.x -= 25;
  80.       }
  81.       else
  82.       {
  83.          this.axis = "x";
  84.          this.yMov = _root.randRange2(4,8);
  85.          this.xMov = -25;
  86.          this.x += 25;
  87.       }
  88.       this.clip.gotoAndStop(this.dir);
  89.       if(_root.superRapid)
  90.       {
  91.          this.clip.body.gotoAndPlay("rapid");
  92.       }
  93.       this.w = this.clip._width;
  94.       this.h = this.clip._height;
  95.       this.power = _root.laserPower;
  96.       if(this.power > 8)
  97.       {
  98.          this.clip.body.gotoAndPlay("boosted");
  99.       }
  100.       _root.stats.fired = _root.stats.fired + 1;
  101.    }
  102.    function hit()
  103.    {
  104.       _root.stats.hit = _root.stats.hit + 1;
  105.       _root.createGunExplo([this.exploX,this.exploY,_root.randRange2(50,80)]);
  106.       _root.removeBroShot("superLaserB" + this.id);
  107.    }
  108.    function main()
  109.    {
  110.       this[this.axis + "Mov"] *= 1.03;
  111.       if(this.x > 1075 || this.x < -75 || this.y > 675 || this.y < -75)
  112.       {
  113.          _root.removeBroShot("superLaserB" + this.id);
  114.       }
  115.       this.x += this.xMov;
  116.       this.y += this.yMov;
  117.       this.clip._x = this.x;
  118.       this.clip._y = this.y;
  119.    }
  120. }
  121.